package edu.liuzihao.controller;

import edu.liuzihao.pojo.R;

import org.apache.ibatis.annotations.Param;
import org.apache.spark.mllib.recommendation.Rating;
import org.junit.runners.Parameterized;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

import recommendPackage.recommend;

/**
 * @author 杨铭
 * 2023/6/20,11:02
 */
@RestController
@RequestMapping("/recommend")
public class RecommendController {
    @RequestMapping("/topN")
    public R getJudge() {
        Map<String, Integer>map1=new HashMap<>();
        map1.put("stuId",361);
        map1.put("gpa",10);
        Map<String, Integer>map2=new HashMap<>();
        map2.put("stuId",390);
        map2.put("gpa",10);
        Map<String, Integer>map3=new HashMap<>();
        map3.put("stuId",436);
        map3.put("gpa",10);
        Map<String,Object>result=new HashMap<>();
        result.put("first",map1);
        result.put("second",map2);
        result.put("third",map3);
        return R.ok().put("result", result);
    }
    @RequestMapping("/cosX")
    public R cosX(@Param("stuId") Integer stuId){
        recommend recommend = new recommend();
        Rating[] recommend1 = recommend.recommend(stuId);
        return R.ok().put("result",recommend1);
    }
}
